﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Ioc;
using Microsoft.Practices.ServiceLocation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.Vsip;
using Microsoft.VisualStudio.TestTools.Common;
using TLM.Wizard.ViewModels;
using TLM.VsmdiReader;
using TLM.Wizard.Context;

namespace TLM.Wizard
{
    public class ViewModelLocator
    {
        static ViewModelLocator()
        {
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            //if (ViewModelBase.IsInDesignModeStatic)
            //{
            //    SimpleIoc.Default.Register<IReportingServiceWrapper, DesignData.ServiceWrapperDesignData>();
            //}
            //else
            //{
            //    SimpleIoc.Default.Register<IReportingServiceWrapper, ReportingService2010Wrapper>();
            //}

            SimpleIoc.Default.Register<ITestManagement>(() => InitObject.TMI);
            SimpleIoc.Default.Register<ITuip>(() => InitObject.UnitTestService);
            SimpleIoc.Default.Register<VsmdiParser>(() => new VsmdiParser(InitObject.PathToVsmdi));
            SimpleIoc.Default.Register<PlaylistGenerator.Generator>();
            SimpleIoc.Default.Register<TestCategoryGenerator.Generator>();

            SimpleIoc.Default.Register<WizardBaseViewModel>();
            SimpleIoc.Default.Register<StartViewModel>();
            SimpleIoc.Default.Register<ConversionChoiceViewModel>();
            SimpleIoc.Default.Register<ConversionProgessViewModel>();
        }

        /// <summary>
        /// Gets the Main property.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance",
            "CA1822:MarkMembersAsStatic",
            Justification = "This non-static member is needed for data binding purposes.")]
        public WizardBaseViewModel WizardBase
        {
            get
            {
                return ServiceLocator.Current.GetInstance<WizardBaseViewModel>();
            }
        }


        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance",
            "CA1822:MarkMembersAsStatic",
            Justification = "This non-static member is needed for data binding purposes.")]
        public StartViewModel Start
        {
            get
            {
                return ServiceLocator.Current.GetInstance<StartViewModel>();
            }
        }

         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance",
            "CA1822:MarkMembersAsStatic",
            Justification = "This non-static member is needed for data binding purposes.")]
        public ConversionChoiceViewModel ConversionChoice
        {
            get
            {
                return ServiceLocator.Current.GetInstance<ConversionChoiceViewModel>();
            }
        }

         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance",
            "CA1822:MarkMembersAsStatic",
            Justification = "This non-static member is needed for data binding purposes.")]
         public ConversionProgessViewModel ConversionProgress
         {
             get
             {
                 return ServiceLocator.Current.GetInstance<ConversionProgessViewModel>();
             }
         }

        /// <summary>
        /// Cleans up all the resources.
        /// </summary>
        public static void Cleanup()
        {

        }
    }
}
